<!DOCTYPE html>
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <meta http-equiv="expires" content="0">
        <meta name="viewport" content="user-scalable=no,width=device-width" />
        <title>Set Sessionstorage</title>

        <script type="text/javascript">
                sessionStorage.clear();

                //true: daten werden lokal abgerufen
                //false: daten werden von einem webserver geladen
                var isDebugMode = true;

                sessionStorage.setItem('isDebugMode', isDebugMode);

                if (isDebugMode === true) {
                        sessionStorage.setItem('routen', '[{"routeName":"Alps Rider","indexSelected":1,"avgRating":"4", "distToStart":"4,3 KM", "distance":"55,8 KM", "poi":"4", "com1":"Wahnsinns-Strecke! Immer wieder...", "com2":"Diese Strecke bietet viel!", "tags":"Dynamisch, HighSpeed, Gebirge"},{"routeName":"TakeItEasy","indexSelected":2,"avgRating":"2", "distToStart":"11 KM", "distance":"19 KM", "poi":"1", "com1":"Es fehlen richtige Highlights...", "com2":"Nur zum Cruisen geeignet.", "tags":"Land"},{"routeName":"Sunshine Route","indexSelected":3,"avgRating":"2", "distToStart":"4 KM"},{"routeName":"Schoene Landschaft","indexSelected":4,"avgRating":"3", "distToStart":"36 KM"},{"routeName":"Big Adventure","indexSelected":5,"avgRating":"4", "distToStart":"112 KM"}]');
						
						sessionStorage.setItem('favRouten', '[{"routeName":"Alps Rider","indexSelected":1,"avgRating":"4", "distToStart":"4,3 KM", "distance":"55,8 KM", "poi":"4", "com1":"Wahnsinns-Strecke! Immer wieder...", "com2":"Diese Strecke bietet viel!", "tags":"Dynamisch, HighSpeed, Gebirge"}]');
                        location.href = './audicted_screen_login.html';
                }
                else {
                        var xmlHttpObject = new XMLHttpRequest();
                        xmlHttpObject.open('GET', 'http://localhost:8080/conversations');

                        xmlHttpObject.onreadystatechange = function () {
                                //alert("xmlHttpObject.readyState = " + xmlHttpObject.readyState + (xmlHttpObject.readyState >= 3 ? " HTTP-Status = " + xmlHttpObject.status : ''));
                                if (xmlHttpObject.readyState == 4 && xmlHttpObject.status == 200) {
                                        sessionStorage.setItem('conversations', xmlHttpObject.responseText);
                                        location.href = './MMI_List_Inbox.html';
                                }
                        };
                        xmlHttpObject.send(null);
                }
        </script>
</head>
<body>
</body>
</html>